package com.itheima.ui;

import com.itheima.service.IAccountService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 获取spring核心容器
 */
public class Client {
    /**
     * @param args
     */
    public static void main(String[] args) {
        //获取核心容器
        /*ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");*/
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        //根据id获取bean对象
      /*  IAccountService as = (IAccountService) ac.getBean("accountService");
        as.saveAccount();*/
        /*IAccountService as = (IAccountService) ac.getBean("accountService2");
        as.saveAccount();*/
       /* IAccountService as = (IAccountService) ac.getBean("accountService3");
        as.saveAccount();*/
        IAccountService as = (IAccountService) ac.getBean("accountService4");
        as.saveAccount();
    }
}
